<template>
	<view>

		<view class="swiper-list mb-2">
			<!-- <view class="uni-list-cell uni-list-cell-pd">
			</view> -->
			<view>
				<view class="uni-padding-wrap px-3 border-bottom">
					<view class="text-box mb-2" scroll-y="true" style="text-align: center; color:green;">
						<text  class="font32">公告栏</text>
					</view>
					<view class="uni-btn-v mb-2	">
						<view class="notice" v-if="noticeList.length">
							<swiper class="swiper-nav" :circular="true" :vertical="true" :autoplay="true"
								:interval="3000" :duration="3000" style="height: 20px;">
								<swiper-item v-for="(item,index) in noticeList" :key="index">
									<view style="width: 100%;height: 20px;display: table-cell;vertical-align: middle;" class="right">{{item.vcTitle}}</view>
								</swiper-item>
							</swiper>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="px-3">
			<view v-if="list.length" class="flex justify-between flex-wrap mb-2">
				<view v-for="(item,index) in list" :index="index" style="width: 300rpx;" @click="_onClick(item)">
					<image style="width: 100%; height: 122px;" :src="item.vcPicUrl" ></image>
					<text class="text" style="text-align: center;">{{item.vcTitle}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniGrid from '@/components/uni-grid/uni-grid.vue';
	import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue';
	export default {
		components: {
			uniGrid,
			uniGridItem
		},
		data() {
			return {
				list: [],
				noticeList: [],
			};
		},
		onLoad() {
			this.getBanner();
			this.getData();
		},
		methods: {
			getBanner() {
				let this_ = this;
				let opts = {
					url: 'Mien/findMienBj.shtml'
				};
				console.log(uni.getStorageSync('classId'))
				let param = {
					longBjId: uni.getStorageSync('classId'),
					typeName: '作品',
					page: 1,
					pageSize: 20
				};
				this_.$http.httpRequest(opts, param).then(
					res => {

						console.log(res.data);
						if (res.data.code == '200') {
							this_.list = res.data.data;
						} else {
							uni.showToast({
								icon: 'none',
								title: res.data.msg
							});
						}
					},
					error => {
						console.log(error);
					}
				);
			},
			getData() {
				let this_ = this;
				let opts = {
					url: 'Mien/findMienBj.shtml'
				};
				console.log(uni.getStorageSync('classId'))
				let param = {
					longBjId: uni.getStorageSync('classId'),
					typeName: '通知',
					page: 1,
					pageSize: 20
				};
				this_.$http.httpRequest(opts, param).then(
					res => {

						console.log(res.data);
						if (res.data.code == '200') {
							this_.noticeList = res.data.data;
						} else {
							uni.showToast({
								icon: 'none',
								title: res.data.msg
							});
						}
					},
					error => {
						console.log(error);
					}
				);
			},
			_onClick(e) {
				let this_ = this;
				uni.navigateTo({
					url: '../articleDetail/articleDetail?id=' + e.longId

				})
			},
		}
	};
</script>

<style scoped>
	/* /deep/.head .uni-grid-item--border{border: 0;}	 */
	/* /deep/.uni-grid-item--border{border-color: #999999;} */
	.bg {
		background-color: #eaebf9;
	}
</style>
